<?php
class NewsModel extends Model{

    public function get_newslist($count,$page,$lang,$mark,$startid,$endid){
        if($count==null)$count=10;

        if($page==null)$page=1;

        $sql = "select * from news where 1=1 ";

        if($mark!=null)$sql.=" and mark=".$mark;

        if($startid!=null)$sql.=" and id>=".$startid;

        if($endid!=null)$sql.=" and id<=".$endid;

        $sql.=" order by time desc";

        $sql .= " limit ".(($page-1)*$count).",".$count;

        return M("news","",'DB_MEETING')->query($sql);

    }

    public function get_comment($count,$page,$nid,$startid,$endid){
        if($count==null)$count=10;

        if($page==null)$page=1;

        $sql = "select * from news_comment where nid = {$nid} ";

        if($startid!=null)$sql.=" and id>=".$startid;

        if($endid!=null)$sql.=" and id<=".$endid;

        $sql.=" order by time desc";

        $sql .= " limit ".(($page-1)*$count).",".$count;

        return M("news_comment","",'DB_MEETING')->query($sql);

    }



}



?>

